<!DOCTYPE html> 
<!--
 Copyright (c) 2017-2018 fortiss GmbH
               2018 Johannes Kepler University Linz 
               2019 Andrea Zoitl
               2019 Jan Holzweber
  
 This program and the accompanying materials are made available under the
 terms of the Eclipse Public License 2.0 which is available at
 http://www.eclipse.org/legal/epl-2.0.

 SPDX-License-Identifier: EPL-2.0
 
 Contributors:
   Jose Cabral 
     - initial API and implementation and/or initial documentation
   Bianca Wiesmayr  - minor text corrections
   Andrea Zoitl - update of the tutorial, updated ToC
   Jan Holzweber - added tutorial Step 7
-->
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Step 3 - Deploy Applications Remotely</title>
    <link rel="stylesheet" type="text/css" href="../help.css" />
  </head>
  <body>
  
<!--********************************************************************************************-->
    
    <h1 id="topOfPage">Step 3 - Deploy Applications Remotely</h1>
    
    <p>This page is part of a guide that gives a walk-through over the major 4diac&nbsp;IDE features.</p>

    <ol start="0">
      <li><a href="../../html/4diacIDE/overview.html">4diac IDE Overview</a></li>
      <li><a href="../../html/4diacIDE/use4diacLocally.html">Use 4diac Locally (Blinking tutorial)</a></li>
      <li><a href="../../html/4diacIDE/distribute4diac.html">Distribute 4diac Applications</a></li>
      <li>Deploy Applications Remotely (YOU ARE HERE!)</li>
      <li><a href="../../html/4diacIDE/createOwnTypes.html">Create Your own Function Block Types</a></li>
      <li><a href="../../html/4diacIDE/otherUseful.html">Other Basic Features</a></li>
      <li><a href="../../html/4diacIDE/advancedFeatures.html">Advanced Features</a></li>
      <li><a href="../../html/4diacIDE/dynamicTypeLoader.html">Deploying new FBs with the Dynamic Type Loader</a></li>
    </ol>

    <p>In this step, the Blink application from <a href="../../html/4diacIDE/distribute4diac.html">Step 2</a> will not run locally, but in another device. 
    This has not too much to show, but it helps understand the workflow when using real PLCs. 
    Since this page is more of an explanation than actually showing, it's up to the reader to actually implement it. 
    The image below shows the architecture of this step.</p>

   <img src="../../html/4diacIDE/img/Step3/remoteArchitecture.png" alt="architecture for the current step"/>

<!--********************-->

   <h2 id="stepsToDeployRem">Steps to Deploy Remotely</h2>

   <ol>
     <li>Select the PLC hardware or other hardware that can run 4diac&nbsp;FORTE. 
     You can check <a href="../../html/before4DIAC/4diacFramework.html#4diacFramework" >here</a> the list of supported platforms. 
     The cheap options are Raspberry Pi, BeagleBoneBlack or another small board that runs Linux. 
     Another option would be to use another computer in your network.</li>
     <li>Compile 4diac&nbsp;FORTE for your PLC or other Hardware. 
     Check <a href="../../html/installation/install.html#FORTEWindowsUnix">here</a> for more information.</li>
     <li>Go to the System Configuration of the <i>BlinkTest</i> and change the address from localhost to the IP address of your device. 
     This is the easiest way to interact with an external device.
     <br>However, certain devices require a special device type. 
     To do this, delete the <i>testee FORTE_PC</i> and pull in the new matching device from the Palette and connect it to the network (map, insert communication FB and connect)  
     <br>In our example the device IP address is 192.168.0.8, you may have another one. The port is 61499 by default.
     <br><img src="../../html/4diacIDE/img/Step3/deviceAddress.png" alt="changing the device address"/>
     <li>Switch to Deployment Perspective set the port to 61500.</li>
     <li>Launch Local Forte</li>
     <li>Run 4diac FORTE on the device. 
     This depends on the device you are using. 
     Normally it has some type of Terminal or FTP that you can access and launch the executable.</li>
     <li>Select both devices (i.e., Counter and Testee) in the Deployment Selection</li>
     <li>Click the <span class="button4diac">Deploy</span> button</li>
     <li>Check that the <i>Deployment Console</i> shows some output, and that no red warning appears on the right nor left of it. 
     If you get something red, something went wrong.
     <br>If an <i>download error message</i> pops up something went wrong too.
     Here are the most common mistakes:     
          <ul>
            <li>wrong IP address</li>
            <li>the firewall is blocking</li>
            <li>4diac&nbsp;FORTE does not run on the external device</li>
          </ul>
     <br>Here is an example of an error message 
     <br><img src="../../html/4diacIDE/img/Step3/downloadError.png" alt="Major Download Error pop-up"/></li>
     <li>You can activate the monitor system and watch the project. 
     Now you can see that <i>true</i> and <i>false</i>alternate as before.</li>
   </ol>

<!--********************-->

   <h2 id="troubleshooting">Troubleshooting</h2>

   <p>In many cases, there are problems even when doing such a simple example. In most cases, it's a network problem.</p>

   <p>If you get an error when downloading to the device, it might be that the IP:PORT is wrong, the device is unreachable (in another network behind a firewall maybe?) or 4diac&nbsp;FORTE is not running on the device.</p>

   <p>In case you click the Buttons but do not see any reaction in the Blinking part, then there's a communication problem. Try the following:</p>

   <ul>
     <li>If you connected your device directly to your computer, add the computer's IP address as default gateway. 
     In some Linux versions, it should be something similar to:
      <div class="code">$ ip route add default [ip] dev [interface]</div> 
      <p>where [ip] is the IP address of your computer, and [interface] is the network interface where it's connected (eth0, usb0, etc.)</p>
      </li>
      <li>Make sure that the interface is prepared to handle Multicast packets.</li>
      <li>On Windows machine: run the command window with admin rights, and type:
      <div class="code">route PRINT</div>
      <p>This lists all the routes used by your PC. 
      You should check that the multicast address used by the application appears there and uses your device IP address as gateway. 
      For our example, it uses the address 239.0.0.1. If it doesn't appear, the address should be added and directed towards the device's IP address. 
      Use the command:</p>
      <div class="code">route ADD 239.0.0.1 MASK 255.255.0.0 [DEVICE_IP] METRIC 255</div>
      <p>and then it should appear when printing again the routes.</p>
        </li>
      <li>Another problem found in Windows is that even though the device receives the packets and replies, the application is not receiving them. 
      Even though the packet appears in Wireshark the application does not receive it. 
      A solution is to disable the FIREWALL completely. After that everything should work fine.</li>
   </ul>

<!--********************************************************************************************-->

<h1>Where to go from here?</h1>

<p>In the next step you will see how to create your own Function Blocks:</p>

<p><a href="../../html/4diacIDE/createOwnTypes.html">Step 4 - Create Your own Function Block Types</a></p>

<p>If you want to go back to the distributed application running completely locally, here's a link:</p>

<p><a href="../../html/4diacIDE/distribute4diac.html">Step 2 - Distribute 4diac Applications</a></p>

<p>If you want to go back to the Start Here page, we leave you here a fast access</p>

<p><a href="../../html/startHere/startHere.html">Where to Start</a></p>

<p class="goToTop"><a href="#topOfPage">Go to top</a></p>

</body>
</html>


